/*
 * @Author: szx
 * @Date: 2022-03-24 16:21:57
 * @LastEditTime: 2022-03-24 16:30:11
 * @Description:
 * @FilePath: \leetcode\300-399\343\343_2.js
 */
/**
 * @param {number} n
 * @return {number}
 */
var integerBreak = function (n) {
    if (n < 4) return n - 1;
    let num = 1;
    while (true) {
        if (n > 4) n -= 3;
        else break;
        num *= 3;
    }
    return num * n;
};
console.log(integerBreak(4));
